
'''
   -*- coding  : ISO-8859-1 -*-
   Description : Create dummy copy of directory with files (size=0)
   History     : 15/05/2008 Initial release
   Author      : M-KPI
'''

import os
import sys


class FSGenerator(object):
    def __init__(self, inDir, outDir):
        self.inDir = os.path.abspath(inDir)
        self.outDir = os.path.abspath(outDir)
        if os.path.exists(outDir):
            print 'you should delete : %s'%outDir
            sys.exit(0)
        os.mkdir(outDir)
        
    def generate(self):
        for root, dirs, files in os.walk(self.inDir):
            print 'root\t: %s'%root
            if root == self.outDir:
                continue
            for dir in dirs:
                in_ = os.path.join(root, dir)
                out = in_.replace(self.inDir, self.outDir)
                if in_ == self.outDir:
                    continue
                if os.path.exists(out):
                    continue
                else:
                    os.mkdir(out)
                    print 'dir\t: %s'%out
            for file_ in files:
                in_ = os.path.join(root, file_)
                out = in_.replace(self.inDir, self.outDir)
                if os.path.exists(out):
                    continue
                else:
                    open(out, 'w').close()
                    print 'file\t: %s'%out
            

def main():
    generator = FSGenerator(sys.argv[1], sys.argv[2])
    generator.generate()

if __name__ == '__main__':
    if len(sys.argv)<3:
        print 'You should define input and output dir\'s'
    else:
        main()






